import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export const constantRouterMap = [
  {
    path: '/login',
    meta: { title: '登录', noCache: true },
    component: (resolve) => require(['@/views/login/login.vue'], resolve),
    hidden: true
  },
  {
    path: '/home',
    component: (resolve) => require(['@/views/home/home'], resolve),

    children: [
      {
        path: '/home/chat',
        component: (resolve) => require(['@/views/chat/chat.vue'], resolve)
      },
      {
        path: '/home/friend',
        component: (resolve) => require(['@/views/friend/friend.vue'], resolve)
      },
      {
        path: '/home/my',
        component: (resolve) => require(['@/views/resume/resume.vue'], resolve)
      },
      {
        path: '/home/groupChat',
        component: (resolve) => require(['@/views/groupchat/groupChat.vue'], resolve)
      }
    ]
  }
]

export default new Router({
  // mode: 'hash',
  mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap,
  // linkActiveClass: 'active'
})
